<?php if(!empty($quyens) && !empty($doanviens)){?>
<table id='tables'>
<tr>
<th></th>
<th>Chức danh</th>
<?php foreach ($quyens as $quyen_id=>$quyenval):?>
<th><?php echo $quyenval.$form->input('',array('class'=>'checkall','id'=>$quyen_id,'label'=>false,'type'=>'checkbox'));?></th>
<?php endforeach;?>
</tr>
<?php foreach ($doanviens as $doanvien):?>
<tr>
<td><?php echo $doanvien[$tenloaidv]['name']?></td>
<td><?php echo (isset($chucvudv[$doanvien[$tenloaidv][$maso]])?$chucvudv[$doanvien[$tenloaidv][$maso]]:'')?></td>
<?php foreach ($quyens as $quyen_id=>$quyenval):?>
<td><?php if(isset($quyendvs[$doanvien[$tenloaidv][$maso]]))
		{
			if(in_array($quyen_id, $quyendvs[$doanvien[$tenloaidv][$maso]]))
				echo $html->link('Xóa',array('controller'=>'phanquyens','action'=>'xoaq',$doanvien[$tenloaidv][$maso],$quyen_id));				
			else
				echo $form->input('',array('name'=>'data[Phanquyen][quyen]['.$doanvien[$tenloaidv][$maso].']['.$quyen_id.']','class'=>'check_'.$quyen_id,'label'=>false,'type'=>'checkbox'));				
		}else
		{
			echo $form->input('',array('name'=>'data[Phanquyen][quyen]['.$doanvien[$tenloaidv][$maso].']['.$quyen_id.']','class'=>'check_'.$quyen_id,'label'=>false,'type'=>'checkbox'));
		}
		?>
</td>
<?php endforeach;?>
</tr>
<?php endforeach;?>
</table>
<?php }//?>